package com.creative.accountsdk.net.account;

import com.creative.accountsdk.UmsChannel;
import com.creative.accountsdk.UserData;
import com.creative.accountsdk.net.Protocol;
import com.creative.accountsdk.net.XParams;
import com.loopj.android.http.RequestParams;

import org.json.JSONObject;

/**
 * Created by wang_qian on 2015/11/28.
 */
public class ChildAddClassProtocal extends Protocol {
    private String  classInviteCode;
    private String  realName;
    private UserData userData;
    public JSONObject  classObject;

    public ChildAddClassProtocal (String classinvitecode,String realname) {
        classInviteCode = classinvitecode;
        realName = realname;
        userData = UserData.getInstance();
    }


    @Override
    public RequestParams getParams() {
        return new XParams().put("uid", userData.getUid())
                .put("cicode",classInviteCode)
                .put("name",realName)
                .put(UmsChannel.PARAM_NAME, UmsChannel.getChannel())
                .getParams();
    }

    @Override
    public String getUrl() {
        return getUrlPrefix()+"class/k/join";
    }

    @Override
    protected void parseReturnMap(JSONObject returnMap) {

        classObject = returnMap.optJSONObject("class");
    }
}
